<#assign tit>K-Yoga团操预约</#assign>
<@page.html title=tit>
<script type="text/javascript" src="${_appPath!}/js/cal.js"></script>
<script type="text/javascript">
  function getminfo(c) {
    if(c!="") {
      getJson("getMember2?cardCode="+c, function(data){
        if(data.ret) {
          var mb = data.data;
          setc(mb);
        } else {
          window.alert(data.msg);
        }
      });
    }
  }
  function setc(mb) {
    var fm = getEl("fm_input");
    fm.cardCode.value = mb.card;
    fm.custName.value = mb.name;
    fm.mobile.value = mb.mobile;
    fm.leftAmount.value = mb.factAmount?(formatMoney(mb.factAmount)+"+"+formatMoney(mb.presentAmount)):"";
    fm.contractTime.value = mb.contractEnd;
  }

  var _isav = false;
  function save() {
    if(_isav) return false;
    var fm = getEl("fm_input");
    postForm(fm.action, fm, saveRet);
    return false;
  }
  function saveRet(data) {
    window.alert(data.msg);
    if(data.ret) {
      cload();
    } else {
      _isav = false;
    }
  }
</script>
<div style="width:600px;">
  <form id="fm_input" method="post" action="_add" onsubmit="return save(this);">
    <div class="kbox">
      <table class="input w4">
        <tr>
          <th>K-Yoga卡号</th>
          <td colspan="3"><input type="text" name="cardCode" value="" req="K-Yoga卡号" onchange="getminfo(this.value);" maxlength="20"></td>
        </tr>
        <tr>
          <th width="85">会员姓名</th>
          <td width="160"><input type="text" name="custName" value="" req="会员姓名" class="disable" readonly></td>
          <th width="85">手机号码</th>
          <td width="160"><input type="text" name="mobile" value="" req="手机号码" class="disable" readonly></td>
        </tr>
        <tr>
          <th>剩余金额</th>
          <td><input type="text" name="leftAmount" value="" class="disable" readonly></td>
          <th>有效期</th>
          <td><input type="text" name="contractTime" value="" maxlength="10" class="disable" readonly></td>
        </tr>
        <tr>
          <th style="height:35px;">课程</th>
          <td colspan="3"><select class="w2" name="ptCode" req="课程"><#if itemList??><#list itemList as t><option value="${t.code}">${t.code} - ${t.chName}</option></#list></#if></select></td>
        </tr>
        <tr>
          <th style="height:35px;">教练</th>
          <td colspan="3"><select class="w2" name="coachCode" req="教练"><#if coachList??><#list coachList as t><option value="${t.code}">${t.code} - ${t.chName}</option></#list></#if></select></td>
        </tr>
        <tr>
          <th style="height:35px;">上课时间</th>
          <td colspan="3"><input type="text" class="date" name="date" value="" req="上课时间" size="10" maxlength="10" onfocus="cal(this);">
            <select name="hh" style="width:60px;"><#list 8..22 as h><option value="${h}"<#if hh?? && hh=h> selected</#if>>${h}</option></#list></select>
            : <select name="mm" style="width:60px;"><#list 0..59 as m><#if m%5=0><option value="${m}"<#if mm?? && mm=m> selected</#if>>${m}</option></#if></#list></select></td>
        </tr>
      </table>
    </div>
    <div class="button"><input type="button" value="确认并提交" onclick="save();"></div>
  </form>
</div>
</@page.html>